<template>
    <div>
      <el-button type="text" @click="dialogFormVisible = true">打开嵌套表单的 Dialog</el-button>
      <el-dialog :visible.sync="dialogFormVisible" width="978px">
        <div class="reg-box">
          <div class="image"><img src="https://static.iautos.cn/www/iautos/dist/image/growth-ring.png" width="100%"></div>
          <div class="form">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane label="快捷登陆" name="first">
                <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="0" class="demo-ruleForm">
                  <el-form-item prop="phone">
                    <el-input v-model="ruleForm.phone" placeholder="请输入手机号码"></el-input>
                  </el-form-item>
                  <el-form-item gutter="10">
                    <el-input style="width: 70%;"></el-input>
                    <el-button style="width: 30%;" type="warning">获取动态码</el-button>
                  </el-form-item>
                  <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
                </el-form>
              </el-tab-pane>
              <el-tab-pane label="密码登陆" name="second">
                <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="0px" class="demo-ruleForm">
                  <el-form-item prop="userName">
                    <el-input v-model="ruleForm.userName" placeholder="用户名"></el-input>
                  </el-form-item>
                  <el-form-item prop="password">
                    <el-input v-model="ruleForm.password" placeholder="密码"></el-input>
                  </el-form-item>
                  <el-form-item prop="QRcode">
                    <el-input v-model="ruleForm.QRcode" placeholder="图片验证码"></el-input>
                  </el-form-item>
                  <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
                </el-form>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
        <el-divider></el-divider>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
      </el-dialog>


    </div>
</template>

<script>
export default {
  name: "test",
  data() {
    return {
      activeName: 'first',
      dialogFormVisible: false,
      ruleForm: {
        phone: '',
        userName: '',
        password: '',
        QRcode: ''
      },
      rules: {
        phone: [
          {required: true, message: '请输入手机号', trigger: 'blur'},
          {min: 11, max: 11, message: '请输入11位的手机号', trigger: 'blur'}
        ],
        userName: [
          {required: true, message: '请输入用戶名', trigger: 'blur'},
          {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}
        ],
        password: [
          {required: true, message: '请输入密碼', trigger: 'blur'},
          {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}
        ],
        QRcode: [
          {required: true, message: '请输入验证码', trigger: 'blur'}
        ]
      }
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    }
  }
}
</script>

<style scoped>
  .reg-box{
    width: 809px;
    height: 361px;
    margin: 0 65px;
    overflow: hidden;
  }
  .image{
    width: 406px;
    height: 293px;
    float: left;
  }
  .form{
    margin-left: 100px;
    width: 300px;
    height: 252px;
    float: left;
  }
</style>